package com.hc.weather.service;

import com.hc.weather.dao.CityRepository;
import com.hc.weather.domain.City;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
/*
* 这是城市业务类
* */

@Service
public class CityService {
    //注入Dao
    @Autowired
    CityRepository cityRepository;

    //提供一个业务方法:获取城市列表数据
    public List<City> cityList() {
        return cityRepository.findAll();    //from City;(hql--面向对象的失去了语句)--转换成真正的sql语句:select * from tab_city
    }
}
